
def LoginLogout_1():
  """Logout in state Established main call"""
  SiebelAg1.MakeCall(ACD2)
  SiebelAg2.AnswerCall()
  Ag2.Logout(ACD2)
  SiebelAg1.ReleaseCall()
  # returning to initial state
  Ag2.Login(ACD2, PosID2); 
  SiebelAg2.SetReady()

def LoginLogout_2():
  """Logout in state Dialing consult call"""

  SiebelAg1.MakeCall(ACD2)
  SiebelAg2.AnswerCall()
  SiebelAg2.InitiateTransfer(DN3)
  Ag2.Logout(ACD2)
  SiebelAg1.ReleaseCall()
  SiebelAg2.ReleaseCall()
  # returning to initial state
  Ag2.Login(ACD2, PosID2); 
  SiebelAg2.SetReady()


def LoginLogout_3():
  """SetNotReady in Established state"""
  c1 = SiebelAg1.MakeCall(ACD2)
  SiebelAg2.AnswerCall()
  SiebelAg2.SetNotReady()
  #call releases or stays depending on option no-call disconnect
  if c1.PartyList:
    SiebelAg1.ReleaseCall()
  SiebelAg2.SetReady()

  

def LoginLogout_4():
  """SetNotReady in state Dialing consult call"""
  SiebelAg1.MakeCall(ACD2)
  SiebelAg2.AnswerCall()
  SiebelAg2.InitiateTransfer(DN3)
  SiebelAg2.SetNotReady() # error or not ready depending option no-call disconnect
  SiebelAg2.ReleaseCall()
  SiebelAg1.ReleaseCall()
  SiebelAg2.SetReady()




def LoginLogout_5():
  """ Login when call is in queue"""
  Ag2.Logout(ACD2)
  SiebelAg1.MakeCall(ACD2)
  Ag2.Login(ACD2, PosID2); 
  SiebelAg2.SetReady()
  SiebelAg2.AnswerCall()
  SiebelAg1.ReleaseCall()
  


def LoginLogout_6():
  """DNDOn, DNDOffl"""
  SiebelAg2.SetBusy()
  if Ag2.state == "Logout":
    # returning to initial state
    SiebelAg2.Login(); 
    SiebelAg2.SetReady()
  else:
    SiebelAg2.CancelBusy()

def LoginLogout_8():
  """DNDOn in state Dialing consult call"""

  SiebelAg1.MakeCall(ACD2)
  SiebelAg2.AnswerCall()
  SiebelAg2.InitiateTransfer(DN3)
  SiebelAg2.SetBusy()
  SiebelAg1.ReleaseCall()
  SiebelAg2.ReleaseCall()
  # returning to initial state
  if Ag2.state == "Logout":
    SiebelAg2.Login(); 
    SiebelAg2.SetReady()
  else:
    SiebelAg2.CancelBusy() 
